<%= javascript_tag "function toggle_form( freshman_id, form_type, link_id, link_string) {
								var form_to_toggle;
								var list_object;
								var list_items;
								form_to_toggle = $(form_type + '_' + freshman_id);
								list_object = form_to_toggle.parentNode.parentNode;
								list_items = $A(list_object.getElementsByTagName('li'));
								if ( form_to_toggle.style.display == 'none' )
								{
                             		list_items.each(function(value) { Element.addClassName(value, 'notselected'); });
                             		form_to_toggle.parentNode.removeClassName('notselected');
                             		form_to_toggle.parentNode.addClassName('selected');
                             		form_to_toggle.style.display = 'block';
                             		$(link_id).innerHTML = 'cancel';
                             	} else {
                             		list_items.each(function(value) { Element.removeClassName(value, 'notselected'); });
                             		form_to_toggle.parentNode.removeClassName('selected');
                             		form_to_toggle.style.display = 'none';
                             		$(link_id).innerHTML = link_string;
                             	}
                             };
                             
                    function stripe_list( this_list ) {
                    			var even = true;
                    			$A(this_list.childNodes).each(function(value) {
                    				if(value.nodeName == 'LI') {
										if (even) {
											Element.addClassName(value, 'even');
											Element.removeClassName(value, 'odd');
										} else {
											Element.addClassName(value, 'odd');
											Element.removeClassName(value, 'even');
										}
										even =  ! even;
									}
                    			});

                    }" %>
<div id="control_panel">
<div id="local_header">
<h2>Desk</h2>

</div>
<div id="col_1">
<p>Logged in as <%= @logged_in_user.username %> for <%= @logged_in_house.name %>. <%= link_to 'log out', :controller => 'auth', :action => 'logout' %></p>
<p>Data current as of <span id="freshness"><%= Time.now %></span>.</p>
<div id="freshman_search">
<h3>Find Freshmen</h3>
<%= text_field_tag :search_name %>
<%= observe_field(:search_name,
                  :frequency => 0.5,
                  :with => 'search_name',
                  :update => 'dynamic_search_freshmen',
                  :url  => {:action => :dynamic_freshman_search}) %>
<ul id="dynamic_search_freshmen"></ul>
</div>
</div>
<div id="col_2">
<h3>Freshmen in House</h3>
<ul id="freshmen_in_house">
<%= render :partial =>'freshman_in_house', :collection => @freshmen_in_house %>
</ul>
<h3>Active Jaunts</h3>
<ul id="active_jaunts">
<%= render :partial =>'active_jaunt', :collection => @active_jaunts %>
</ul>
<h3>Overnighters</h3>
<ul id="overnighting_freshmen">
<%= render :partial =>'overnighting_freshman', :collection => @overnighting_freshmen %>
</ul>
</div>
</div>
<%= javascript_tag "$A(document.getElementsByTagName('ul')).each(function(value) {stripe_list(value);});" %>
<%= periodically_call_remote(:url => {:action => :update_freshmen_in_house_and_jaunts}, :frequency => 15) %>
